package com.shg.web.service;

import java.util.HashMap;
import java.util.Map;

import javax.annotation.Resource;

import com.shg.bean.Users;
import com.shg.service.UsersService;

import net.sf.json.JSONObject;

public class UserLoginImpl implements UserLogin {

	@Resource
	private UsersService usersService;
	
	public String login(String userEmail, String passWord) {
		try {
			Users user = usersService.getLogin(userEmail, passWord);
			if(user!=null){
				Map<String, String> map=new HashMap<String, String>();
				map.put("userEmail", user.getUserEmail());
				map.put("userName", user.getUserName());
				map.put("passWord", user.getPassWord());
				map.put("logo", user.getLogo());
				map.put("id", user.getId());
				JSONObject jsonObject = JSONObject.fromObject(map);
				return jsonObject.toString();
			}
		} catch (Exception e) {
			e.printStackTrace();
		}
		return null;
	}

}
